package com.study.demo_wrapper.config;

import com.study.demo_wrapper.converts.MyConvert;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ConversionServiceFactoryBean;
import org.springframework.core.convert.converter.Converter;

import java.util.HashSet;
import java.util.Set;

/**
 * @Name: BeanConfig
 * @Description: java类作用描述
 * @Author: yn
 * @CreateDate: 2022/9/14 10:17
 * @Remark: 特殊说明
 * @Version: 1.0
 */
@Configuration
public class BeanConfig {
    @Bean
    public ConversionServiceFactoryBean conversionService(){
        ConversionServiceFactoryBean conversionServiceFactoryBean = new ConversionServiceFactoryBean();
        Set<Converter> converters = new HashSet<>();
        converters.add(new MyConvert());
        conversionServiceFactoryBean.setConverters(converters);
        return conversionServiceFactoryBean;
    }
}
